
from amplitude.emailer import Emailer

class Feedback(Emailer):
    
    def feedback_mail(self, item):
        """sends a mail to the admin with the feedback.
        Params: req -- the request
                exc -- an HTML representation of the exception (usu. provided by mako.exceptions.html_error_template().render())
        """
        from email.mime.text import MIMEText
        msg = MIMEText(self.render('/feedback/feedback_mail.txt.mako', item=item))
        msg['From'] = self.config.Email.fromaddr
        msg['To'] = self.config.Site.admin
        msg['Subject'] = "[%s] Feedback: %s" % (self.config.Site.name, item.subject or '')
        return msg
        